﻿#include <iostream> 
#include <cstring> 
#include <fstream> 
#include <sstream> 
#include <regex>
#include <smach.h>
using namespace std;
int main()
{
	ifstream in("email.txt");
	if (!in)
	{
		cout << "文件打开失败" << endl;
		return -1;
	}
	string line;
	regex reg("\\w+@\\w+.\\w+");
	smach result;
	string str = "";
	while (getline(in, line))
	{
		str += line;
	}
	auto end = sregex_iterator();
	sregex_iterator it(str.begin(), str.end(), reg);
	cout << str << endl;
	for (; it != end; ++it)
	{
		result = *it;
		cout << result.str() << endl;
	}
}